<?php
namespace config\lib;

class Request
{
    //对象实例
    protected static $instance;

    //创建对象实例
    public static function instance($options = [])
    {
        if(is_null(self::$instance)){
            self::$instance = new static($options);
        }
        return self::$instance;
    }

    //定义模块
    public function module($module = null)
    {
        if (!is_null($module)) {
            $this->module = $module;
            return $this;
        } else {
            return $this->module ?: '';
        }
    }

    //定义控制器
    public function controller($controller = null)
    {
        if (!is_null($controller)) {
            $this->controller = $controller;
            return $this;
        } else {
            return $this->controller ?: '';
        }
    }

    //定义操作
    public function action($action = null)
    {
        if (!is_null($action)) {
            $this->action = $action;
            return $this;
        }else{
            return $this->action ?: '';
        }
    }
}
